package com.ch.personmis.controller;

import com.ch.personmis.dto.UserDTO;
import com.ch.personmis.entity.UserEntity;
import com.ch.personmis.service.AdminService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource; // 替换为jakarta.annotation
import jakarta.servlet.http.HttpSession; // 替换为jakarta.servlet

@RestController
public class AdminController {
    @Resource
    private AdminService adminService;

    @PostMapping(value = "/login")
    public String login(@RequestBody UserEntity userEntity, HttpSession session) {
        return adminService.login(userEntity, session);
    }

    @PostMapping("/register")
    public int register(@RequestBody UserDTO dto, HttpSession session) {

        return adminService.register(dto,session);
    }
}